UDP is a simpler protocol than TCP. The Udp component sends and receives datagrams. UDP differs from TCP:
UDP provides basic datagram service between two TCP/IP hosts. UDP sends and receives datagrams or blocks of data (unlike TCP which provides a reliable stream of data). UDP is used as transport for the Trivial File Transfer Protocol (TFTP), Simple Network Management Protocol (SNMP), Network Time Protocol (NTP), and others.
UDP enhances IP by providing a header that routes packet data to the application that binds itself to the addressed port number. UDP routes data between matching applications on TCP/IP hosts.
UDP provides an unreliable transfer of data. Unlike TCP, it is not guaranteed that packets will find their way to their ultimate destination. For this reason, most protocols that use UDP utilize acknowledgments.
UDP is a datagram-oriented protocol. A block of data, if successfully sent and received, arrives as a block of data exactly the same size as that sent. The IP layer takes care of reassembling any packets that may have been fragmented into smaller packets during its transmission. A checksum is used for packet data and corrupted packets are discarded.
UDP system buffering provides simultaneous two-way (full-duplex) data transfer.
Unlike TCP, UDP can broadcast and multicast data. Broadcasting occurs when a host sends a datagram to all other hosts on the network. Multicasting occurs when a host sends a datagram to all hosts that are members of a particular multicast group. Since TCP is connection-oriented, sending data to multiple hosts is impossible.
A broadcasted datagram is sent to the specially designated broadcast address "255.255.255.255". All hosts listening on the wire will receive the datagram. A router will not forward a broadcast datagram, so it will be limited to the local network.
Often broadcasting can provide unnecessary overhead. Consider a network with 30 hosts. One host on this network broadcasts information that only 10 of the hosts on the network are interested in. This means 20 uninterested hosts must process the datagram up the protocol stack to the transport layer before discarding the data.
Alternatively, the interested hosts can join a multicast group. Multicasting uses a range of addresses from 224.0.0.0 to 239.255.255.255, known as class D addresses. The 10 participating hosts can simply join a multicast group in this range, and send datagrams that will only be received by hosts who have joined the same multicast group.
UDP is quick to set up, easy to use, light on system resources, and simple to program. UDP also can broadcast packets to all computers on a network segment, something TCP cannot do. For these reasons UDP is often used for: